//package com.tzy.gateway.config;
//import com.tzy.gateway.service.RedisService;
//import org.springframework.context.annotation.Configuration;
//import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
//import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
//import org.springframework.web.servlet.config.annotation.ViewControllerRegistry;
//import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
//import javax.annotation.Resource;
///**
// * web相关的配置类
// */
////@Configuration
//public class WebConfig implements WebMvcConfigurer {
//    @Resource
//    private RedisService redisService;
//    /**
//     * 配置拦截器
//     * @param registry
//     */
//    @Override
//    public void addInterceptors(InterceptorRegistry registry) {
//        registry.addInterceptor(new LoginInterceptor(redisService))
//                //需要拦截的路径
//                .addPathPatterns("/**")
//                //不需要拦截的路径
//                .excludePathPatterns("/error","/assets/**");
//    }
//    /**
//     * 添加静态资源处理程序
//     * @param registry
//     */
//    @Override
//    public void addResourceHandlers(ResourceHandlerRegistry registry) {
////        registry.addResourceHandler("/**").addResourceLocations("classpath:/static/");
////        图片放在resource/static/下面
////        访问直接ip:端口/图片名称.后缀 //示例: http://localhost:8082/api/assets/1.jpg
////        registry.addResourceHandler("/**").addResourceLocations("classpath:/static/");
//        //static目录下要有assets文件夹
//        registry.addResourceHandler("/assets/**").addResourceLocations("file:D:/upload/");
//        WebMvcConfigurer.super.addResourceHandlers(registry);
//    }
//    @Override
//    public void addViewControllers(ViewControllerRegistry registry) {
////        registry.addViewController("/webSocket");
//    }
//
//}
